var nums = [3,9,20,null,null,15,7,null,10]

var maxDepth = function(root) {
    var left=0,right=0;
    root.forEach((item,index) => {
        if(item != null&&index%2!=0) {
            left++
        }else if(item !=null && index%2==0) {
            right++
        }
    });
    return left>right?left:right
}

console.log(maxDepth(nums))